/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package view;

import java.awt.Component;
import java.util.GregorianCalendar;
import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;
import model.User;

/**
 *
 * @author Ira
 */
public class CalendarCellRenderer extends DefaultTableCellRenderer {
	
	@Override
    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
        super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);

		
		
		GregorianCalendar cal = (GregorianCalendar)value;
		if(cal == null) {
			this.setText("dispo");
			return this;
		}
		this.setText(cal.get(GregorianCalendar.DATE) + "/" + (cal.get(GregorianCalendar.MONTH)+1) + "/" + Integer.toString(cal.get(GregorianCalendar.YEAR)));
		
        return this;
    }
}
